home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility1 / gsview08.zip / GSVIEW.H < prev    next >
C/C++ Source or Header  |  1993-07-07  |  15KB  |  469 lines

  1. /*
  2.  * gsview.h -- Include file for GSVIEW.EXE 
  3.  * Copyright (C) 1993  Russell Lang
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  *   Author: Russell Lang
  20.  * Internet: rjl@monu1.cc.monash.edu.au
  21.  */
  22.  
  23. #define GSVIEW_VERSION "0.8 beta 1993-07-07"
  24.  
  25. #define ID_ANSWER    51
  26. #define ID_PROMPT    52
  27. #define ID_HELP        53
  28.  
  29. #define IDM_OPEN    101
  30. #define IDM_CLOSE    102
  31. #define IDM_NEXT    103
  32. #define IDM_NEXTSKIP    104
  33. #define IDM_REDISPLAY   105
  34. #define IDM_PREV    106
  35. #define IDM_PREVSKIP    107
  36. #define IDM_GOTO    108
  37. #define IDM_INFO    109
  38. #define IDM_SELECT    110
  39. #define IDM_PRINT    111
  40. #define IDM_PRINTTOFILE 112
  41. #define IDM_SPOOL    113
  42. #define IDM_EXTRACT    114
  43. #define IDM_PSTOEPS    115
  44. #define IDM_EXIT    116
  45. #define IDM_DROP    117
  46.  
  47. #define IDM_COPYCLIP    151
  48. #define IDM_PASTETO    152
  49. #define IDM_CONVERT    153
  50. #define IDM_MAKEEPSI    154
  51. #define IDM_MAKEEPST4    155
  52. #define IDM_MAKEEPST    156
  53. #define IDM_MAKEEPSW    157
  54. #define IDM_EXTRACTPS    158
  55. #define IDM_EXTRACTPRE    159
  56.  
  57. #define IDM_GSCOMMAND      175
  58. #define IDM_SOUNDS      176
  59. #define IDM_SETTINGS      177
  60. #define IDM_SAVESETTINGS  178
  61. #define IDM_SAVEDIR      179
  62. #define IDM_BUTTONSHOW      180
  63. #define IDM_QUICK      181
  64. #define IDM_AUTOREDISPLAY 182
  65. #define IDM_EPSFCLIP      183
  66. #define IDM_EPSFWARN      184
  67.  
  68. #define IDM_PORTRAIT    201
  69. #define IDM_LANDSCAPE   202
  70. #define IDM_UPSIDEDOWN  203
  71. #define IDM_SEASCAPE    204
  72. #define IDM_SWAPLANDSCAPE 205
  73.  
  74. #define IDM_RESOLUTION  251
  75.  
  76. #define IDM_LETTER    301
  77. #define IDM_LETTERSMALL    302
  78. #define IDM_TABLOID    303
  79. #define IDM_LEDGER    304
  80. #define IDM_LEGAL    305
  81. #define IDM_STATEMENT    306
  82. #define IDM_EXECUTIVE    307
  83. #define IDM_A3        308
  84. #define IDM_A4        309
  85. #define IDM_A4SMALL    310
  86. #define IDM_A5        311
  87. #define IDM_B4        312
  88. #define IDM_B5        313
  89. #define IDM_FOLIO    314
  90. #define IDM_QUARTO    315
  91. #define IDM_10X14    316
  92. #define IDM_USERSIZE    317
  93. #define IDM_MEDIALAST    318
  94.  
  95. #define IDM_HELPCONTENT 351
  96. #define IDM_HELPSEARCH    352
  97. #define IDM_ABOUT    353
  98.  
  99. #define INFO_FILE    401
  100. #define INFO_TYPE    402
  101. #define INFO_TITLE    403
  102. #define INFO_DATE    404
  103. #define INFO_BBOX    405
  104. #define INFO_ORIENT    406
  105. #define INFO_ORDER    407
  106. #define INFO_DEFMEDIA    408
  107. #define INFO_NUMPAGES    409
  108. #define INFO_PAGE    410
  109. #define INFO_BITMAP    411
  110. #define INFO_ICON    412
  111.  
  112. #define ABOUT_ICON    451
  113. #define ABOUT_VERSION    452
  114.  
  115. #define SOUND_EVENT    501
  116. #define SOUND_FILE    502
  117. #define SOUND_PATH    503
  118. #define SOUND_TEST    504
  119.  
  120. #define SPOOL_PORT    525
  121.  
  122. #define CANCEL_PCDONE    541
  123.  
  124. #define PAGE_LIST    551
  125. #define PAGE_ALL    552
  126. #define PAGE_ODD    553
  127. #define PAGE_EVEN    554
  128.  
  129. #define DEVICE_NAME    561
  130. #define DEVICE_RES    562
  131. #define DEVICE_RESTEXT    563
  132. #define DEVICE_PROP    564
  133.  
  134. #define PROP_NAME    571
  135. #define PROP_VALUE    572
  136.  
  137. #define EPS_INTERCHANGE    581
  138. #define EPS_WINDOWS    582
  139. #define EPS_TIFF    583
  140.  
  141. #define BB_PROMPT    591
  142. #define BB_CLICK    592
  143.  
  144. #define FILTER_PS    1
  145. #define FILTER_EPS    2
  146. #define FILTER_EPI    3
  147. #define FILTER_ALL    4
  148. #define FILTER_BMP    5
  149. #define FILTER_TIFF    6
  150. #define FILTER_WMF    7
  151. #define IDS_FILTER    601
  152. #define IDS_TITLE    602
  153. #define IDS_HELPFILE    603
  154. #define IDS_WRONGGS    604
  155. #define IDS_BUSY    605
  156.  
  157. #define IDS_FILE    610
  158. #define IDS_NOFILE    611
  159. #define IDS_PAGE    612
  160. #define IDS_NOPAGE    613
  161. #define IDS_LANDSCAPE    614
  162. #define IDS_PORTRAIT    615
  163. #define IDS_ASCEND    616
  164. #define IDS_DESCEND    617
  165. #define IDS_SPECIAL    618
  166. #define IDS_EPSF    619
  167. #define IDS_EPSI    620
  168. #define IDS_EPST    621
  169. #define IDS_EPSW    622
  170. #define IDS_DSC        623
  171. #define IDS_NOTDSC    624
  172. #define IDS_PAGEINFO    625
  173.  
  174. #define IDS_OUTPUTFILE    630
  175. #define IDS_PRINTINGALL    631
  176. #define IDS_PRINTFILE    632
  177. #define IDS_NOSPOOL    633
  178. #define IDS_SELECTPAGE    634
  179. #define IDS_SELECTPAGES    635
  180. #define IDS_TIMEOUT    636
  181. #define IDS_NOTIMER    637
  182. #define IDS_NOTOPEN    638
  183. #define IDS_CANNOTRUN    639
  184. #define IDS_TOOLONG    640
  185. #define IDS_WAIT    641
  186. #define IDS_NOMORE    642
  187. #define IDS_GSCOMMAND    643
  188. #define IDS_RES        644
  189. #define    IDS_USERWIDTH    645
  190. #define    IDS_USERHEIGHT    646
  191. #define IDS_BADEPS    647
  192. #define IDS_NOPREVIEW    648
  193. #define IDS_NOTDFNAME   649
  194. #define IDS_PIPEERR    650
  195. #define IDS_CANCELDONE    651
  196.  
  197. #define IDS_SOUNDNAME    670
  198. #define IDS_SNDPAGE    671
  199. #define IDS_SNDNOPAGE    672
  200. #define IDS_SNDNONUMBER 673
  201. #define IDS_SNDNOTOPEN    674
  202. #define IDS_SNDERROR    675
  203. #define IDS_SNDTIMEOUT    676
  204. #define IDS_SNDSTART    677
  205. #define IDS_SNDEXIT    678
  206. #define IDS_SOUNDNOMM    679
  207. #define IDS_NONE    680
  208. #define IDS_SPKR    681
  209.  
  210. /* help topics */
  211. #define IDS_TOPICROOT    701
  212. #define IDS_TOPICOPEN    702
  213. #define IDS_TOPICPRINT    703
  214. #define IDS_TOPICEDIT    704
  215. #define IDS_TOPICGSCMD    705
  216. #define IDS_TOPICSOUND    706
  217. #define IDS_TOPICMEDIA  707
  218. #define IDS_TOPICPSTOEPS 708
  219.  
  220. /* ps_to_eps */
  221. #define IDS_BBPROMPT    750
  222. #define IDS_BBPROMPT1    751
  223. #define IDS_BBPROMPT2    752
  224. #define IDS_BBPROMPT3    753
  225. #define IDS_EPSONEPAGE    754
  226. #define IDS_EPSQPAGES    755
  227. #define IDS_EPSNOBBOX    756
  228. #define IDS_EPSREAD     757
  229.  
  230. /* now the stuff that the resource compiler shouldn't see */
  231. #ifndef RC_INVOKED
  232. /* messages used between gsview and gswin */
  233. #define WM_GSVIEW WM_USER+0
  234. /* from gswin to gsview */
  235. #define HWND_TEXT    0
  236. #define HWND_IMGCHILD    1
  237. #define GSWIN_CLOSE    2
  238. #define SYNC_OUTPUT    3
  239. #define OUTPUT_PAGE    4
  240. #define SCROLL_POSITION 5
  241. #define PIPE_REQUEST    6
  242. /* from gsview to gswin image window */
  243. #define NEXT_PAGE    10
  244. #define COPY_CLIPBOARD    11
  245. /* from gsview to gswin text window */
  246. #define PIPE_DATA    12
  247.  
  248. #define MAXSTR 80
  249. #define PROFILE_SIZE 2048
  250. #define DEFAULT_GSCOMMAND "gswin"
  251. #define DEFAULT_RESOLUTION 96.0
  252. #define INIFILE "gsview.ini"
  253. #define INISECTION "Options"
  254. #define DEVSECTION "Devices"
  255.  
  256. extern char szAppName[MAXSTR];        /* application name - for title bar */
  257. extern const char szClassName[];    /* window class */
  258. extern const char szScratch[];        /* temporary filename prefix */
  259.  
  260. /* initialised in init.c */
  261. extern BOOL is_win31;            /* To allow selective use of win 3.1 features */
  262. extern char szHelpName[MAXSTR];        /* buffer for building help filename */
  263. extern char szHelpTopic[48];        /* topic for OFN_SHOWHELP */
  264. extern UINT help_message;        /* message sent by OFN_SHOWHELP */
  265. extern HMENU hmenu;            /* main menu */
  266. extern HACCEL haccel;            /* menu accelerators */
  267. extern HCURSOR hcWait;
  268. extern POINT img_offset;        /* offset to gswin child window */
  269. extern POINT info_file;            /* position of file information */
  270. extern POINT info_page;            /* position of page information */
  271. extern RECT  info_rect;            /* position and size of brief info area */
  272. extern RECT  info_coord;        /* position and size of coordinate information */
  273. extern RECT  button_rect;        /* position and size of button area */
  274.  
  275. extern HINSTANCE phInstance;        /* instance of gsview */
  276. extern HINSTANCE gswin_hinst;        /* instance of gswin */
  277. extern HWND hwndimg;            /* gsview main window */
  278. extern HWND hDlgModeless;        /* any modeless dialog box */
  279. extern HWND hwndtext;            /* gswin text window */
  280. extern HWND hwndimgchild;        /* gswin image child window */
  281. extern int bitmap_scrollx;        /* offset from bitmap to origin of child window */
  282. extern int bitmap_scrolly;
  283. extern int bitmap_width;        /* size of gswin bitmap in pixels */
  284. extern int bitmap_height;
  285.  
  286. extern struct document *doc;        /* DSC structure.  NULL if not DSC */
  287. extern int pagenum;            /* current page number */
  288. extern char dfname[MAXSTR];        /* name of selected document file */
  289. extern FILE *dfile;            /* selected file */
  290. extern FILE *cfile;            /* command file */
  291. extern char efname[MAXSTR];        /* name of temp file extracted from DOS EPS file */
  292. extern char pcfname[MAXSTR];        /* name of temp command file for printing */
  293. extern char pfname[MAXSTR];        /* name of temp file for printing options */
  294. extern BOOL is_ctrld;            /* TRUE if DSC except for ctrl+D at start of file */
  295. extern int preview;            /* preview type IDS_EPSF, IDS_EPSI, etc. */
  296. extern BOOL page_ready;            /* true when gswin has sent an OUTPUT_PAGE and is waiting for NEXT_PAGE */
  297. extern BOOL at_prompt;            /* true if at prompt */
  298. extern BOOL saved;            /* true if interpreter state currently saved in /gssave */
  299. extern int bitmap_scrollx;        /* offset from bitmap to origin of child window */
  300. extern int bitmap_scrolly;
  301. extern OPENFILENAME ofn;
  302. extern char szOFilename[MAXSTR];    /* filename for OFN */
  303. #define DEFAULT_TIMEOUT 120        /* 120 seconds */
  304. #define CLOSE_TIMEOUT    20
  305. extern BOOL bTimeout;            /* true if timeout occured */
  306. extern WNDPROC lpfnButtonWndProc;    /* default button WndProc */
  307. extern HINSTANCE hlib_mmsystem;        /* DLL containing sndPlaySound function */
  308. typedef BOOL (WINAPI *FPSPS)(LPCSTR, UINT);
  309. extern FPSPS lpfnSndPlaySound;        /* pointer to sndPlaySound function if loaded */
  310. extern BOOL epsf_clipped;        /* clipping this page? */
  311. #define BEEP "beep"            /* profile entry for a speaker beep */
  312. extern BOOL debug;            /* /D command line option used */
  313. struct page_list_s {
  314.     int current;    /* index of current selection */
  315.     BOOL multiple;    /* true if multiple selection allowed */
  316.     BOOL *select;    /* array of selection flags */
  317. };
  318. extern struct page_list_s page_list;
  319.  
  320. /* these can be saved in the INI file */
  321. extern char szGSwin[128];
  322. extern POINT img_origin;
  323. extern POINT img_size;
  324. extern BOOL quick;
  325. extern BOOL settings;
  326. extern BOOL button_show;
  327. extern int media;
  328. extern int user_width, user_height;
  329. extern BOOL epsf_clip;
  330. extern BOOL epsf_warn;
  331. extern BOOL redisplay;
  332. extern int orientation;
  333. extern BOOL swap_landscape;
  334. extern float xdpi, ydpi;
  335. extern UINT timeout;
  336. extern BOOL save_dir;
  337. extern char device_name[32];
  338. extern char device_resolution[32];
  339. #define SOUND_PAGE 0
  340. #define SOUND_NOPAGE 1
  341. #define SOUND_NONUMBER 2
  342. #define SOUND_NOTOPEN 3
  343. #define SOUND_ERROR 4
  344. #define SOUND_TIMEOUT 5
  345. #define SOUND_START 6
  346. #define SOUND_EXIT 7
  347. #define NUMSOUND 8
  348. struct sound_s {
  349.     char *entry;        /* profile entry */
  350.     int title;        /* Resource string */
  351.     char file[MAXSTR];    /* empty, "beep", or .WAV sound to play */
  352. };
  353. extern struct sound_s sound[NUMSOUND];
  354.  
  355. /* in gsview.c */
  356. BOOL get_cursorpos(int *x, int *y);
  357. void info_wait(BOOL);
  358. void play_sound(int);
  359. BOOL set_timer(UINT);
  360. void clear_timer(void);
  361. void gserror(UINT, char *, UINT, int);
  362. void pserror(char *);
  363. LRESULT CALLBACK _export MenuButtonProc(HWND, UINT, WPARAM, LPARAM);
  364. LRESULT CALLBACK _export WndImgProc(HWND, UINT, WPARAM, LPARAM);
  365.  
  366. /* in init.c */
  367. void gsview_init0(LPSTR);
  368. void gsview_init1(LPSTR);
  369. void gsview_create(void);
  370. void show_buttons(void);
  371. void read_profile(void);
  372. void write_profile(void);
  373.  
  374. /* in display.c */
  375. int get_papersizes_index(void);
  376. void gswin_size(void);
  377. void gswin_resize(void);
  378. void gsview_orientation(int);
  379. void gsview_media(int);
  380. int gswin_open(void);
  381. int gswin_close(void);
  382. void next_page(void);
  383. void do_message(void);
  384. void gsview_endfile(void);
  385. void gsview_openfile(char *);
  386. void gsview_select(void);
  387. void gsview_selectfile(char *);
  388. void gsview_display(void);
  389. void gsview_displayfile(char *);
  390. void fix_orientation(FILE *f);
  391. FILE * gp_open_scratch_file(const char *prefix, char *fname, const char *mode);
  392. BOOL dfreopen(void);
  393. void dfclose(void);
  394. BOOL dsc_scan(char *fname);
  395. void dsc_getpages(FILE *f, int first, int last);
  396. void dsc_header(FILE *f);
  397. void dsc_dopage(void);
  398. void dsc_next(int);
  399. void dsc_prev(int);
  400. int map_page(int page);
  401.  
  402. /* in dialog.c */
  403. #define OPEN FALSE
  404. #define SAVE TRUE
  405. BOOL getfilename(LPSTR, BOOL, UINT, UINT, UINT);
  406. BOOL get_string(char *, char *);
  407. BOOL CALLBACK _export InputDlgProc(HWND, UINT, WPARAM, LPARAM);
  408. BOOL CALLBACK _export AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
  409. BOOL CALLBACK _export SoundDlgProc(HWND, UINT, WPARAM, LPARAM);
  410. BOOL CALLBACK _export InfoDlgProc(HWND, UINT, WPARAM, LPARAM);
  411. BOOL get_page(int *, BOOL);
  412. BOOL CALLBACK _export PageDlgProc(HWND, UINT, WPARAM, LPARAM);
  413. BOOL gsview_usersize(void);
  414.  
  415. /* in pipe.c */
  416. void pipeinit(void);    /* prepare pipe for opening */
  417. FILE *pipeopen(void);    /* open pipe for first time */
  418. void pipeclose(void);    /* finished with pipe, close & delete temp files */
  419. void pipereset(void);    /* pipe is empty, do cleanup */
  420. void piperequest(void);    /* request from gswin for pipe data */
  421. void pipeflush(void);    /* start sending data through pipe */
  422. BOOL is_pipe_done(void);    /* true if pipe has just been reset */
  423.  
  424. /* in print.c */
  425. BOOL CALLBACK _export DeviceDlgProc(HWND, UINT, WPARAM, LPARAM);
  426. BOOL CALLBACK _export CancelDlgProc(HWND, UINT, WPARAM, LPARAM);
  427. BOOL CALLBACK _export SpoolDlgProc(HWND, UINT, WPARAM, LPARAM);
  428. void gsview_spool(void);
  429. int gp_printfile(char *filename);
  430. void pscopydoc(FILE *fp);
  431. char *get_devices(void);
  432. void print_cleanup(void);
  433. void gsview_print(BOOL);
  434. void gsview_extract(void);
  435.  
  436. /* clip.c */
  437. LONG dib_bytewidth(LPBITMAPINFOHEADER);
  438. UINT dib_pal_colors(LPBITMAPINFOHEADER);
  439. void clip_to_file(void);
  440. void clip_convert(void);
  441. void clip_add_palette(void);
  442. void clip_add_ddb(void);
  443. void clip_add_dib(void);
  444. void extract_eps(void);
  445. void extract_doseps(WORD);
  446. void make_eps_metafile(void);
  447. void make_eps_tiff(WORD);
  448. void make_eps_interchange(void);
  449. void ps_to_eps(void);
  450.  
  451. #ifdef WIN32
  452. /* Windows NT has never been tried, but there macros fix up the */
  453.  * known differences from Windows 3.1 */
  454. /* imitation pipes will need to be rewritten to use real pipes */
  455. #define MoveTo(hdc,x,y) MoveToEx((hdc),(x),(y),(LPPOINT)NULL)
  456. #define SetClassCursor(hwnd, hcursor) SetClassLong((hwnd), GCL_HCURSOR, (LONG)(hcursor))
  457. #define GetClassCursor(hwnd) ((HCURSOR)GetClassLong((hwnd), GCL_HCURSOR))
  458. #define GetNotification(wParam,lParam) (HIWORD(wParam))
  459. #define SendDlgNotification(hwnd, id, notice) \
  460.     SendMessage((hwnd), WM_COMMAND, MAKELONG((id),(notice)), GetDlgItem((hwnd),(id)))
  461. #else
  462. #define SetClassCursor(hwnd, hcursor) SetClassWord(hwnd, GCW_HCURSOR, (WORD)(hcursor))
  463. #define GetClassCursor(hwnd) ((HCURSOR)GetClassWord(hwnd, GCW_HCURSOR))
  464. #define GetNotification(wParam,lParam) (HIWORD(lParam))
  465. #define SendDlgNotification(hwnd, id, notice) \
  466.     SendMessage((hwnd), WM_COMMAND, id, MAKELPARAM(GetDlgItem((hwnd),(id)),(notice)))
  467. #endif
  468. #endif /* !RC_INVOKED */
  469.